<div class="page-header">
  <h1>商品评论列表</h1>
</div>
<table class="table table-striped">
  <thead>
    <tr>
      <th>用户名</th>
      <th>商品名称</th>
      <th>用户昵称</th>
      <th>评论内容</th>
      <th>评论时间</th>
      <th>操作</th>
    </tr>
  </thead>
  <tbody>
    <% @comments.each do |comment| %>
      <tr>
        <td><%= comment.member_user.email rescue '' %></td>
        <td><%= comment.good.name %></td>
        <td><%= comment.nickname %></td>
        <td><%= comment.content %></td>
        <td><%= comment.created_at.strftime("%Y-%m-%d") %></td>
        <td>
          <%= link_to "查看", comment_path(comment), :class => 'btn btn-default btn-xs' %>
          <%= link_to "编辑", edit_comment_path(comment), :class => 'btn btn-primary btn-xs' %>
          <%= link_to "删除", comment_path(comment), :method => :delete,
                      :data => { :confirm => '确认删除评论吗?' }, :class => 'btn btn-xs btn-danger' %>
        </td>
      </tr>
    <% end %>
  </tbody>
</table>

<%= link_to "新建", new_comment_path, :class => 'btn btn-primary' %>
